# Contributor: Clayton Craft <clayton@craftyguy.net>
# Maintainer: Clayton Craft <clayton@craftyguy.net>
pkgname=purism-ectool
pkgver=1.12
pkgrel=1
pkgdesc="EC firmware tool for Purism systems"
url="https://source.puri.sm/firmware/librem-ec"
arch="x86_64"
license="MIT"
makedepends="cargo eudev-dev linux-headers cargo-auditable"
source="$pkgname-$pkgver.tar.gz::https://source.puri.sm/firmware/librem-ec/-/archive/$pkgver/librem-ec-$pkgver.tar.gz"
builddir="$srcdir/librem-ec-$pkgver/tool"


prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo auditable build --frozen --release
}

check() {
	cargo test --frozen
}

package() {
	install -Dm755 target/release/purism_ectool \
		"$pkgdir"/usr/bin/purism_ectool
}

sha512sums="
7a7cdc46a2fad2f19727deca1aba32b610e244dd54b758b5c62bcca9039ea0c2f7ccc3c5c864147f6501b2c0a4fda12ceed36c273271061c5f07568838465649  purism-ectool-1.12.tar.gz
"
